package com.pfizer.Entity;

import java.util.Date;

/**
 * pNews--<b>公佈欄信息實體</b>--靜態變量為創建數據庫表需要的字段名
 * 
 * @author krui
 * @version 1.40 2011/11/19
 */
 
public class pNews{
	
	public static final String 	NEWSSTRING="News";
	public static final String 	NEWSIDSTRING="News_ID";
	public static final String 	NEWSSUBJSTRING="News_Subj";
	public static final String 	NEWSCONTSTRING="News_Cont";
	public static final String	NEWSBGTIMESTRING="Bg_Time";
	public static final String 	NEWSEDTIMESTRING="Ed_Time";
	public static final String  PUBLISHERSTRING="Publisher";
	
	
	private long 		News_ID=0;
	private String 	News_Subj="";
	private String 	News_Publisher="";
	private String		News_Cont="";
	private long		Bg_Time;
	private long	 	Ed_Time;
	private Date		dt;
	public pNews(long _ID,String _Subj,String _Cont,String _BgTime,String _EdTime)
	{
		this.News_ID=_ID;
		this.News_Subj=_Subj;
		this.News_Cont=_Cont;
		dt=new Date(_BgTime);
		dt.setHours(0);
		dt.setMinutes(0);
		dt.setSeconds(1);
		this.Bg_Time=dt.getTime();
		dt=new Date(_EdTime);
		dt.setHours(23);
		dt.setMinutes(59);
		dt.setSeconds(59);
		this.Ed_Time=dt.getTime();
	}
	public pNews()
	{
		
	}
	public pNews(String _ID)
	{
		this.News_ID=new Long(_ID).intValue();
	}
	public void setID(String _ID)
	{
		this.News_ID=new Long(_ID).intValue();
	}
	public void setID(long _ID)
	{
		this.News_ID=_ID;
	}
	public long getID()
	{
		return this.News_ID;
	}
	public void setPublisher(String _Publisher)
	{
		this.News_Publisher=_Publisher;
	}
	public String getPublisher()
	{
		return this.News_Publisher;
	}
	public void setSubj(String _Subj)
	{
		this.News_Subj=_Subj;
	}
	public String getSubj()
	{
		return this.News_Subj;
	}
	public void setCont(String  _Cont)
	{
		this.News_Cont=_Cont;
	}
	public String getCont()
	{
		return this.News_Cont;
	}
	public void setBgTime(String _BgTime)
	{
		_BgTime=_BgTime.replaceAll("-", "/");
		_BgTime+=" 00:00:00";
		dt=new Date(_BgTime);
		this.Bg_Time=dt.getTime()/1000;
	}
	public void setBgTime(long _BgTime)
	{
		this.Bg_Time=_BgTime;
	}
	public long getBgTime()
	{
		return this.Bg_Time;
	}
	public void setEdTime(String _EdTime)
	{
		_EdTime=_EdTime.replaceAll("-", "/");
		_EdTime+=" 23:59:59";
		dt=new Date(_EdTime);
		this.Ed_Time=dt.getTime()/1000;
	}
	public void setEdTime(long _EdTime)
	{
		this.Ed_Time=_EdTime;
	}
	public long getEdTime()
	{
		return this.Ed_Time;
	}
	
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return String.valueOf(this.News_ID)+",name  "+this.News_Subj+"  Desc  "+this.News_Cont+"\n";
	}
}
